﻿namespace XJay.Scheduler
{
    public class HostedService : IHostedService
    {
        private ISchedulerrManger schedulerCenter;

        public HostedService(ISchedulerrManger schedulerCenter)
        {
            this.schedulerCenter = schedulerCenter;
        }

        public async Task StartAsync(CancellationToken cancellationToken)
        {
            //开启调度器
            await schedulerCenter.StartSchedulerAsync();
        }

        public Task StopAsync(CancellationToken cancellationToken)
        {
            return Task.CompletedTask;
        }
    }
}
